package barbershop.com.controller;

import barbershop.com.entity.Role;
import barbershop.com.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/role")
public class RoleController {
    @Autowired
    private RoleService roleService;

    @RequestMapping("/add")
    public Role addRole(@RequestBody Role record){
        return this.roleService.insert(record);
    }

    @RequestMapping("/delete")
    public Boolean deleteRole(@RequestBody Role record){
        return this.roleService.delete(record);
    }

    @RequestMapping("/update")
    public Role updateRole(@RequestBody Role record){
        return this.roleService.update(record);
    }

    @RequestMapping("/find")
    public Role findRole(@RequestBody Role record){
        return this.roleService.find(record);
    }
}
